import { Injectable } from '@angular/core';
import { isIframe } from 'mstcomponents/core';
import { MstBaseInfo } from 'mstcomponents/router';
import { MstRouteDataService } from 'mstcomponents/router';

export function StartupServiceFactory(startupService: StartUpService) {
  return () => startupService.load();
}

@Injectable({ providedIn: 'root' })
export class StartUpService {
  constructor(private mstRouteData: MstRouteDataService) {}

  async load() {
    if (!isIframe()) {
      await this.mstRouteData.getBaseInfo().then((_: MstBaseInfo) => {
        console.log(_);
      });
    }
  }
}
